﻿/*----------------------------------------------------------------
// Copyright (C) 2011 上海
// 版权所有。 
//
// 文件名：IngredientsAbstract
// 文件功能描述：食材抽象类
//
// 
// 创建标识：2012-01-14 周士祎
//
// 修改标识：
// 修改描述：
//
//
//----------------------------------------------------------------*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DAO.WaiGaoQiao;
using System.Data;
using System.Data.SqlClient;

namespace Model.WaiGaoQiao
{
    public abstract class IngredientsAbstract
    {
        /// <summary>
        /// ID自增主键
        /// </summary>
        public int ID 
        { 
            get;
            set;
        }
        /// <summary>
        /// 订单编号
        /// </summary>
        public string Ord_No 
        {
            get;
            set;
        }
        /// <summary>
        /// 供应商ID
        /// </summary>
        public int Supplier_ID 
        { 
            get;
            set;
        }
        /// <summary>
        /// 操作员ID
        /// </summary>
        public string Operator_ID 
        {
            get;
            set;
        }
        /// <summary>
        /// 食材类型
        /// </summary>
        public string GoodsType
        {
            get;
            set;
        }
        /// <summary>
        /// 备注
        /// </summary>
        public string Remark 
        { 
            get;
            set;
        }
        /// <summary>
        /// 录入时间
        /// </summary>
        public DateTime RecordDateTime 
        { 
            get;
            set;
        }

        protected DataAccessInstockGroup DAIG
        {
            get;
            set;
        }
        protected int rowcount;

        public int _rowcount
        {
            get { return rowcount; }
        }
        /// <summary>
        /// 保存食材入库
        /// </summary>
        /// <param name="instginfo"></param>
        /// <returns></returns>
        public abstract int SaveInstockGroup(IngredientsAbstract instginfo);

        /// <summary>
        /// 删除食材入库
        /// </summary>
        /// <param name="ID">主键</param>
        /// <returns></returns>
        public abstract int DeleteInstockGroup(string OrdNo);

        /// <summary>
        /// 获取一条食材入库信息
        /// </summary>
        /// <param name="ID">主键</param>
        /// <returns>食材入库信息</returns>
        public abstract IngredientsAbstract GetInstockGroupInfo(int ID);


        /// <summary>
        /// 读取DataSet
        /// </summary>
        /// <param name="ds"></param>
        /// <returns></returns>
        protected virtual IList<IngredientsAbstract> ReadDataSet(DataSet ds)
        {
            IList<IngredientsAbstract> list = new List<IngredientsAbstract>();
            if (ds != null && ds.Tables.Count > 0)
            {
                foreach (DataRow item in ds.Tables[0].Rows)
                {
                    list.Add(new InstockGroupInfo
                    {
                        ID = Convert.ToInt32(item["ID"]),
                        Operator_ID = Convert.ToString(item["Operator_ID"]),
                        Ord_No = Convert.ToString(item["Ord_No"]),
                        RecordDateTime = Convert.ToDateTime(item["RecordDateTime"]),
                        Remark = Convert.ToString(item["Remark"]),
                        Supplier_ID = Convert.ToInt32(item["Supplier_ID"])
                    });
                }
            }
            return list;
        }
        /// <summary>
        /// 获取食材入库信息
        /// </summary>
        /// <param name="pagesize">页大小</param>
        /// <param name="startindex">起始页</param>
        /// <param name="dict">查询条件</param>
        /// <returns>食材入库信息</returns>
        public abstract IList<IngredientsAbstract> GetInstockGroupInfo(int pagesize, int startindex,
                                                                       IngredientsAbstract instockGroupInfo);//, string instocktype

        /// <summary>
        /// 获取食材主表的数据
        /// </summary>
        /// <returns></returns>
        public abstract int GetRowCount();

    }
}
